package se.nestorthon.branding.server.webapp;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.apache.commons.fileupload.disk.DiskFileItemFactory;

public class Initializer implements ServletContextListener {

	public enum ContextParam
	{
		FILE_FACTORY("FileFactory");
		
		private String name;

		private ContextParam(String name)
		{
			this.name = name;
		}
		
		public String getName()
		{
			return this.name;
		}
	}
	public void contextDestroyed(ServletContextEvent arg0) {
		// noop
	}

	public void contextInitialized(ServletContextEvent event) {
		ServletContext ctx = event.getServletContext();
		ctx.setAttribute(ContextParam.FILE_FACTORY.getName(), new DiskFileItemFactory() );
	}

}
